package com.example.rbacmanage.service.app.impl;

import com.example.rbacmanage.entity.app.MessageBoard;
import com.example.rbacmanage.mapper.app.MessageBoardMapper;
import com.example.rbacmanage.service.app.MessageBoardService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class MessageBoardServiceImpl implements MessageBoardService {
    @Autowired
    private MessageBoardMapper messageBoardMapper;
    @Override
    public void save(MessageBoard messageBoard) {
        messageBoardMapper.insert(messageBoard);
    }

    @Override
    public void remove(Long[] ids) {
        for (Long id : ids) {
            messageBoardMapper.del(id);
        }
    }

    @Override
    public void update(MessageBoard messageBoard) {
        messageBoardMapper.update(messageBoard);
    }

    @Override
    public List<MessageBoard> getAll(MessageBoard messageBoard) {
        return messageBoardMapper.list(messageBoard);
    }

    @Override
    public PageInfo<MessageBoard> getPage(MessageBoard messageBoard) {
        return new PageInfo<>(messageBoardMapper.list(messageBoard));
    }

    @Override
    public MessageBoard getById(Long id) {
        return messageBoardMapper.queryOneById(id);
    }

    @Override
    public Integer getCount(MessageBoard messageBoard) {
        return messageBoardMapper.count(messageBoard);
    }
}
